% TEST_ID: LANG-EXPAND-0068
% CATEGORY: language/convert
% 测试 str2double

function test_str2double
    assert_isequal(str2double(["1.0", "2.0"]) == [1.0, 2.0])

    assert_isequal(str2double(["1.0i", "2.0"]) == [1.0i, 2.0])

    assert_isequal(str2double(["1+2.0i", "2.0"]) == [1 + 2.0i, 2.0])

    assert_isequal(str2double(["1.2+2e5i", "2.0"]) == [1.2 + 2e5i, 2.0])

    assert_isequal(str2double('123') == 123)

    assert_isequal(str2double(['123'; '456']) == 142536)

    assert_isequal(str2double('1.02e3 - 2.3e-1i') == 1020 - 0.23i)

    assert_isequal(isnan(str2double('1.02e-2.3i')))

    assert_isequal(str2double('-1.3i') == -1.3i)
    assert_isequal(str2double('-100,000i') == -100000i)

    assert_isequal(str2double('-1.43e-2i') == -1.43e-2i)
end



function assert_isequal(x, y)
    assert(isequal(x, y));
end